/**
 * 
 */
package org.dezenho.server.IP;

import java.util.Date;

import org.prevayler.TransactionWithQuery;

/**
 * @author Dafne
 *
 */
@SuppressWarnings("serial")
public class PalavraCreateTransaction implements TransactionWithQuery {

    private String palavra;
    /**
     * @param palavra
     */
    public PalavraCreateTransaction(String palavra) {
	this.palavra = palavra;
    }

    public PalavraCreateTransaction() {
	//default constructor needed for xml serialisation
    }

    /**
     * @param prevalentSystem
     * @param executionTime
     * @return
     */
    public Object executeAndQuery(Object prevalentSystem, Date executionTime) throws Exception {
    	Palavra newPalavra = ((ListaPalavras) prevalentSystem).add();
    	newPalavra.setPalavra(palavra);
    	return newPalavra;
    	}

}
